<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>设置>设置人员和角色</title>
<META content="text/html; charset=UTF-8" http-equiv=Content-Type>
<%@include file="../../../include/include.jsp"%>
<link rel="stylesheet" type="text/css" href="${csspath}/public.css" />
<link rel="stylesheet" type="text/css" href="${csspath}/style_l.css" />
<script src="${jspath}/jquery/jquery-1.4.4.js" type="text/javascript"></script>
<script type="text/javascript" src="${jspath}/jquery/jquery.ui.min.js"></script>
<script type="text/javascript" src="${jspath}/public.js"></script>
<script type="text/javascript" src="${jspath}/jquery/jquery.ui.draggable.js"></script>
<script type="text/javascript" src="${jspath}/jquery/jquery.alerts.js"></script>
<link rel="stylesheet" type="text/css" href="${csspath}/jquery.alerts.css" />
<link rel="stylesheet" type="text/css" href="${csspath}/validationEngine.jquery.css" />
<script src="${jspath}/jquery/validate/jquery.validationEngine.js" type="text/javascript"></script>
<script src="${jspath}/jquery/validate/jquery.validationEngine-zh.js" type="text/javascript"></script>
<script type="text/javascript" src="${jspath}/jquery/jquery.ellipsis.js"></script>
<script type="text/javascript">
$(function() {
	$("#isSgm").val(${queryDto.isSgm});
	
	$(".longtext").wordLimit(10);

	if(${queryDto.operationFlag}){
		jAlert("保存成功!","提示信息");
	}
	$("#search_form").validationEngine( {
	});
	
	//$("#idetail").click(function() {
	//	var radioVal = $("input:radio:checked").val();
	//	if (radioVal != undefined) {
	//		$("#idetail").attr("href", "viewauthorizeduser/" + radioVal);
	//	} else {
	//		jAlert("请选择列表信息!","提示信息");	
	//	}
	//});

	$("#imodify").click(function() {
		var radioVal = $("input:radio:checked").val();
		if (radioVal != undefined) {
			$("#imodify").attr("href", "${webcontext}/userPerm/userAndRole/editauthorizeduser/" + radioVal);
		} else {
			jAlert("请选择记录！","提示信息");	
		}
	});
	

	$("#ascid").click(function() {
		openWindow("${webcontext}/common/selectDealersForMac?dealerCodeInputName=dealerCode");
	});

	$("#iusergrpcd").click(function() {
		openWindow("${webcontext}/common/getAllUserGroup?outputid=userGroupCode", "UserGroup");
	});

	$("#irolecd").click(function() {
		openWindow("${webcontext}/common/getAllRolePage?outputid=roleCode","Roles");
	});

	$("#iorgcd").click(function() {
		openWindow("${webcontext}/common/getDefaultOrgPage?outputid=organizationCode","Organizations");
	});

	$("#isub").click(function() {
		if($("#search_form").validationEngine({returnIsValid:true})) {
			search();
		}
	});
	
});

function exportList() {
	var oldAction = $("#search_form").attr("action");
	$("#search_form").attr("action", "${webcontext}/userPerm/userAndRole/exportauthorizedusers");
	$("#search_form").submit();
	$("#search_form").attr("action", oldAction);
}

function openWindow(iUrl,iName,iWidth,iHeight) {
	var url = ''; 
	var name = ''; 
	var w = 914; 
	var h = 520;
	if(iUrl) {url=iUrl}
	if(iName) {name=iName}
	if(iWidth) {w=iWidth}
	if(iHeight) {h=iHeight}
	var l = (window.screen.availWidth-10-w)/2;
	var t = (window.screen.availHeight-30-h)/2;
	window.open(url,name,'height='+h+',innerHeight='+h+',width='+w+',innerWidth='+w+',top='+t+',left='+l+',toolbar=no,menubar=no,scrollbars=yes,resizeable=no,location=no,status=no');
}

function search() {
	$("#search_form").submit();
}

</script>
</head>

<body>

	<!-- content -->
	<div id="content">
		<!-- wrap -->
		<div id="wrap">

			<!-- breadcrumb -->
			<div id="breadcrumb">
				<span>设置</span>
				<span>&gt;</span>
				<span>设置人员和角色</span>
			</div>
			<!-- /breadcrumb -->
			<!-- search_div -->
			<form:form id="search_form" action="${webcontext}/userPerm/userAndRole/queryauthorizedusers" method="post" modelAttribute="queryDto">
			<div class="search_div">
				<div class="spliter h_10"></div>
				<table class="search_tab">
					<tr>
					  <td class="label">用户ID：</td>
					  <td>
					  	<form:input path="userCode" maxlength="30" cssClass="validate[optional,length[0,90]] text"/>
					  </td>
					  <td class="label">员工姓名：</td>
					  <td>
						<form:input path="employeeName" maxlength="30" cssClass="validate[optional,length[0,90]] text"/>
					  </td>
					  <td class="label">手机：</td>
					  <td>
					  	<form:input path="mobilePhone" maxlength="11" cssClass="validate[custom[mobilePhoneOrNull]] text"/>
					  </td>
				  	</tr>
                    <tr>
						<td colspan="8" class="center2">
							<input type="button" class="btn" value="查询" id="isub" />&nbsp;&nbsp;<input type="reset" class="btn" value="重置"/>
						</td>
					</tr>
				</table>
				<div class="spliter h_10"></div>
			</div>
			<!-- /search_div -->
				
			<div class="spliter h_10"></div>
			<!-- page_div -->
			<div class="page_div">
				<div class="page_info">
<!--					<a id="idetail" href="#" class="xiangqing">详情</a>				-->
                    <a id="imodify" href="#" class="edit">修改</a>
<!--					<a class="export" href="#" onClick="exportList();">导出</a>    -->
				</div>
				<%@include file="../../../common/headerpage.jsp"%>	
			</div>
			<!-- /page_div -->
			<!-- data_div -->
			<div class="data_div">
				<table class="data_tab">
					<tr>
						<th width="5%" class="w_5">选择</th>
                        <th width="5%">用户ID</th>
<!--                        <th width="8%">经销商代码</th>-->
<!--                        <th width="8%">经销商简称</th>-->
						<th width="7%">员工姓名</th>
						<th width="4%">岗位</th>
						<th width="4%">角色</th>	
                        <th width="4%">组织</th>
                        <th width="7%">手机</th>
                        <th width="8%">生日</th>
                        <th width="16%">住址</th>
                    </tr>
                   
                    <core:forEach items="${listDto}" var="employee">
					<tr>
					  <td class="align_m">
					  	<input type="radio" name="radioCheck"  value="${employee.userId}" />
					  </td>
					  <td>${employee.userCode}</td>
<!--					  <td>${employee.dealerCode}</td>-->
<!--					  <td>${employee.dealerAbbreName}</td>-->
					  <td>${employee.employeeName}</td>
					  <td>
					  	<core:forEach items="${employee.userUsrGrp}" var="userUsrGrp">
					  		${userUsrGrp.userGroupName}<br>
					  	</core:forEach>
					  </td>
					  <td><div class="longtext" title="${employee.selectRoleNames}"><span>
						${employee.selectRoleNames}</span></div></td>
					  <td>
					  	<core:forEach items="${employee.orgUser}" var="orgUser">
					  		${orgUser.orgName}<br>
					  	</core:forEach>
					  </td>
					  <td>${employee.mobilePhone}</td>
					  <td><fmt:formatDate value="${employee.birthDate}" pattern="yyyy-MM-dd"/></td>
					  <td>${employee.address}</td>
                    </tr>
                    </core:forEach>
                  
				</table>
			</div>
			<!-- /data_div -->
            
            <!-- page_div -->
			<div class="page_div">
				<%@include file="../../../common/page.jsp"%>
			</div>
			<!-- /page_div -->
            
            </form:form>
		</div>
		<!-- /wrap -->
	</div>
	<!-- /content -->

</body>
</html>